package com.microtf.inscription.jpa.entity;


import lombok.Data;
import org.hibernate.annotations.Type;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 设置属性条目
 * @author guliuzhong
 */
@Entity
@Table(indexes = {@Index(name = "setting_name", columnList = "name"), @Index(name = "qt_setting_name_key", columnList = "name,key", unique = true)})
@Data
public class SettingItem {
    /**
     * 自增ID
     */
    @Id
    @SequenceGenerator(sequenceName = "setting_item_id_seq", name = "genSettingId", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "genSettingId")
    Integer id;
    /**
     * 设置名
     */
    String name;
    /**
     * 设置key
     */
    String key;
    /**
     * 设置值
     * 值只能为字符串，支持大文本
     */
    @Lob
    @Type(type = "org.hibernate.type.TextType")
    String value;
}
